{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tensorflow.compat.v1 as tf\n",
    "tf.disable_v2_behavior()\n",
    "\n",
    "\n",
    "##定义一个简单的计算图，实现两个常量相加的操作\n",
    "with tf.name_scope('graph') as scope:\n",
    "    a = tf.constant(1,name='a')\n",
    "    b = tf.constant(2,name='b')\n",
    "    add = tf.add(a,b,name='add')\n",
    "sess = tf.Session()\n",
    " \n",
    "##生成一个写日志的writer，并将当前的tensorflow计算图写入日志\n",
    "writer = tf.summary.FileWriter('D:\\\\project\\\\algorithm\\\\python\\\\tensorflow_study',sess.graph)\n",
    "init = tf.global_variables_initializer()\n",
    "sess.run(init)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
